/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 晓星航
 * Date: 2023-10-18
 * Time: 10:48
 */
public class PingPongMatch {
    public static void main(String[] args) {
        // 定义甲队和乙队的三名队员
        String[] teamA = {"A", "B", "C"};
        String[] teamB = {"X", "Y", "Z"};

        // 使用两层循环枚举比赛顺序
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                // 判断 A 不与 X 比赛和 C 不与 X、Z 比赛的情况
                if ((i == 0 && j == 0) || (i == 2 && j == 0) || (i == 2 && j == 2)) {
                    continue;
                }

                // 构造对应的比赛名单
                String[] match = {teamA[0] + "-" + teamB[i], teamA[1] + "-" + teamB[j], teamA[2] + "-" + teamB[3 - i - j]};

                // 输出结果并结束程序
                System.out.println("比赛名单：");
                for (String s : match) {
                    System.out.println(s);
                }
                return;
            }
        }

        // 如果找不到合法的比赛顺序，则输出无解
        System.out.println("无解");
    }
}
